﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Entities;
using Datalayer;
using Common;
using System.Data;

namespace Portal_KonTum.Pages
{
	public partial class Hoi_Dap : System.Web.UI.Page
	{
        IQueryMgr iq;
        protected void Page_Load(object sender, EventArgs e)
        {
            string id = Request.QueryString["ID"];
            if (!IsPostBack)
            {
                if(id!=null)
                {
                    Panel1.Visible = true;
                    BinData();
                }
                else
                {
                    Panel1.Visible = false;
                    loadData();
                }
            }
        }
        void BinData()
        {
            string id = Request.QueryString["ID"];
            Comment ex = new Comment();
            iq = QueryMgr.GetDbInstance();
            try
            {
                Guid idc = new Guid();
                idc = MethodCommon.Get_Guid(id);
                ex = iq.CM_GetCommentByID(idc);

                lblComContent.Text = ex.ComContent;
                lblcomReply.Text = ex.ComReply;
                lblEmail.Text = ex.Email;
                lblFullname.Text = ex.FullName;
                lblTime.Text = ex.CreatedDate.ToString();

                loadData();
            }
            catch (Exception exa)
            {
                Alert.Show(exa.ToString());
            }
        }
        void loadData()
        {
            iq = QueryMgr.GetDbInstance();
                List<Comment> list1 = new List<Comment>();
                list1 = iq.CM_GetAllCommentByChecked();
                DataList1.DataSource = list1;
                DataList1.DataBind();
        }
	}
}